import ajax from './index'

export function adPage(query) {
    return ajax({
        url: '/backend/ad',
        method: 'get',
        params: query
    });
}

export function adAll() {
    return ajax({
        url: '/backend/ad/all',
        method: 'get',
    });
}

export function addAd(obj) {
    return ajax({
        url: '/backend/ad',
        method: 'post',
        data: obj
    });
}

export function getAd(id) {
    return ajax({
        url: '/backend/ad/' + id,
        method: 'get'
    })
}

export function delAd(id) {
    return ajax({
        url: '/backend/ad/delete?ids=' + id,
        method: 'post'
    })
}

export function putAd(id, obj) {
    return ajax({
        url: '/backend/ad/' + id,
        method: 'post',
        data: obj
    })
}

export function adItem(ad_id) {
    return ajax({
        url: '/backend/ad_item/list/' + ad_id,
        method: 'get'
    });
}

export function addAdItem(obj) {
    return ajax({
        url: '/backend/ad_item/' + obj.adId,
        method: 'post',
        data: obj
    });
}

export function getAdItem(id) {
    return ajax({
        url: '/backend/ad_item/' + id,
        method: 'get'
    })
}

export function delAdItem(row) {
    return ajax({
        url: '/backend/ad_item/delete/' + row.adId + "/" + row.id,
        method: 'post'
    })
}

export function putAdItem(id, obj) {
    return ajax({
        url: '/backend/ad_item/' + obj.adId + "/" + id,
        method: 'post',
        data: obj
    })
}